package com.inxedu.os.edu.service.course.impl;

import com.inxedu.os.edu.dao.EduWebsiteCourseMapper;
import com.inxedu.os.edu.pojo.EduWebsiteCourse;
import com.inxedu.os.edu.pojo.EduWebsiteCourseExample;
import com.inxedu.os.edu.service.course.AdminWebSiteCourse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminWebsiteCourseImpl implements AdminWebSiteCourse {
    @Autowired
    private EduWebsiteCourseMapper websiteCourseMapper;
    @Override
    //查询
    public List<EduWebsiteCourse> select(EduWebsiteCourse websiteCourse) {
        EduWebsiteCourseExample example =new EduWebsiteCourseExample();
        EduWebsiteCourseExample.Criteria criteria = example.createCriteria();
        List<EduWebsiteCourse> eduWebsiteCourses = websiteCourseMapper.selectByExample(example);
        return eduWebsiteCourses;
    }
    //添加
    @Override
    public int insetEduWebsiteCourse(EduWebsiteCourse eduWebsiteCourse) {

        System.out.println(eduWebsiteCourse.getCoursenum());
        int i = websiteCourseMapper.insert(eduWebsiteCourse);
        return i;
    }
    //修改查询
    @Override
    public EduWebsiteCourse selectAll(Integer id) {
        EduWebsiteCourse eduWebsiteCourse = websiteCourseMapper.selectByPrimaryKey(id);
        return eduWebsiteCourse;
    }
    //修改
    @Override
    public void update(EduWebsiteCourse course) {
        websiteCourseMapper.updateByPrimaryKey(course);
    }
    //删除
    @Override
    public int delete(Integer id) {
        int i = websiteCourseMapper.deleteByPrimaryKey(id);
        return i;
    }
}
